package com.boc.ewr.outsrc.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.hutool.core.bean.BeanUtil;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
import com.boc.ewr.outsrc.entity.OutsrcCostSetting;
import com.boc.ewr.outsrc.service.IOutsrcCostSettingService;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;

import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;

 /**
 * @Description: 外包管理-费用设置表
 * @Author: jeecg-boot
 * @Date:   2023-06-28
 * @Version: V1.0
 */
@Api(tags="外包管理-费用设置表")
@RestController
@RequestMapping("/outsrc/outsrcCostSetting")
@Slf4j
public class OutsrcCostSettingController extends JeecgController<OutsrcCostSetting, IOutsrcCostSettingService> {
	@Autowired
	private IOutsrcCostSettingService outsrcCostSettingService;

	private static final String COST_ID = "COST-FEE";

	/**
	 *  编辑
	 *
	 * @param inData
	 * @return
	 */
	@AutoLog(value = "外包管理-费用设置表-编辑")
	@ApiOperation(value="外包管理-费用设置表-编辑", notes="外包管理-费用设置表-编辑")
	//@RequiresPermissions("com.boc.ewr:outsrc_cost_setting:edit")
	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
	public Result<String> edit(@RequestBody OutsrcCostSetting inData) {
		OutsrcCostSetting outsrcCostSetting = new OutsrcCostSetting();
		BeanUtils.copyProperties(inData,outsrcCostSetting);
		outsrcCostSetting.setId(COST_ID);
		outsrcCostSettingService.updateById(outsrcCostSetting);
		return Result.OK("编辑成功!");
	}

	/**
	 * 通过id查询
	 *
	 * @return
	 */
	//@AutoLog(value = "外包管理-费用设置表-通过id查询")
	@ApiOperation(value="外包管理-费用设置表-通过id查询", notes="外包管理-费用设置表-通过id查询")
	@GetMapping(value = "/queryById")
	public Result<OutsrcCostSetting> queryById() {
		OutsrcCostSetting outsrcCostSetting = outsrcCostSettingService.getById(COST_ID);

		return Result.OK(outsrcCostSetting);
	}

}
